home *** CD-ROM | disk | FTP | other *** search
- import java.applet.Applet;
- import java.awt.Color;
- import java.awt.Container;
- import java.awt.Event;
- import java.awt.Font;
- import java.awt.Label;
- import java.awt.LayoutManager;
- import java.awt.Panel;
- import java.awt.Scrollbar;
-
- public class Applet1 extends Applet {
- Scrollbar verticalScrollbar1;
- Label label1;
- Label label2;
- Label label3;
- Label label4;
- Label label5;
- Label label6;
-
- public void init() {
- super.init();
- ((Container)this).setLayout((LayoutManager)null);
- ((Panel)this).addNotify();
- ((Applet)this).resize(311, 211);
- this.verticalScrollbar1 = new Scrollbar(1, 0, 0, 0, 200);
- this.verticalScrollbar1.reshape(140, 60, 16, 120);
- ((Container)this).add(this.verticalScrollbar1);
- this.label1 = new Label("0");
- this.label1.reshape(42, 75, 70, 15);
- this.label1.setFont(new Font("Dialog", 1, 12));
- ((Container)this).add(this.label1);
- this.label2 = new Label("0");
- this.label2.reshape(203, 75, 70, 15);
- this.label2.setFont(new Font("Dialog", 1, 12));
- ((Container)this).add(this.label2);
- this.label3 = new Label("Centigrade");
- this.label3.reshape(42, 53, 84, 15);
- ((Container)this).add(this.label3);
- this.label4 = new Label("Fahrenheit");
- this.label4.reshape(203, 53, 70, 15);
- this.label4.setFont(new Font("Dialog", 0, 12));
- ((Container)this).add(this.label4);
- this.label5 = new Label("0 -");
- this.label5.reshape(105, 68, 28, 15);
- this.label5.setFont(new Font("Dialog", 2, 12));
- ((Container)this).add(this.label5);
- this.label6 = new Label("200 -");
- this.label6.reshape(98, 158, 42, 15);
- this.label6.setFont(new Font("Dialog", 2, 12));
- this.label6.setForeground(new Color(0));
- ((Container)this).add(this.label6);
- }
-
- public boolean handleEvent(Event event) {
- if (event.target == this.verticalScrollbar1) {
- this.label1.setText("" + this.verticalScrollbar1.getValue());
- this.label2.setText("" + (this.verticalScrollbar1.getValue() * 9 / 5 + 32));
- }
-
- return super.handleEvent(event);
- }
- }
-